Factor out some common objects and creation logic