added db functionality with tests to the library