Updated tests
Refactored database class