Adds DB implementation

Fxes #20
Add tests to DB implementation

Fixes #27