Working commit
Lots of fixes to things, clean up database, add table class.