Refactoring to use all directives rather than a controller