Support for Doctrine Annotations and cleanup.

Cleaned up a bunch of things to make them more easily testable.
Support added for using Doctrine's annotations library.