refactored controllers and directives
edited view