Moving to model-controller structure