Refactored database classes - moved into their own project.