Updated database class and new test main