recreated functionality with directives