controllers and views refactored