added more db stuff
made first iteration of database functions. needs testing