Clearer AngularJS code with big refactoring and added directives and
templates