refactoring html and directives