front end refactoring - repositories, controllers and templates