significant compile and directive refactor. work still in progress