refactored lots of things into directives. currently broken