Added database contract.
Added database helper.
Added tests to check that the database works.
Refactored the database test.