db implemented and all tests working