Factor out more code