changed directive to work with hooks