Merge pull request #49 from BorisVerk/master

refactored database code to use the postgres.py wrapper