Refactored directives
Refactored to clean up types