some db work; my first pull request with all my changes