Upgraded database access to use the Yank abstraction layer
A bit of refactoring and updated comments
Added and fixed a few tests