Factor out some common code
6 files changed