reorganizing into directives, services, and controllers in a sane way