Database

Include the database management.

Tables are generated from the code.
Should be possible to deal with the database properly. Need some deep testing though.

A lot of Refactors.
Fix issue #23.