Refactor of controllers, views and tests