refactored template out of directive