refactored controllers and views