modified the controller and views to fit rails conventions