Cleaning up code for reuasbility and adding DB API features.
Cleaned up database code and web response handling.
Updated HTML templates