refactor search and workplace in directives