Moved some files and added started moving around the database code.
Spreading out application code.
SQL code is now handled by custom functions.