Big cleanup, and change to seperate the two databases.
Add missing import.
Merge pull request #1 from oampo/master

Database changes, and cleanup