Ctrl and directives refactoring