added controller and view logic