improve controller, model and view separation. create lots of utility functions.