More DB tables and refactorings
Style changes
More db tweaks and tests