got exersizes working
refactored out db access functions to a seperate module