code clean up.
implemented service layer and hooked it up with controller.