Code changes to separate directives code from the controller