Code cleanup - move some controller methods to model