begins to move logic from controller to model