moved database related stuff to another file