split database functions
removed redundancies, added refresh function
moved database functions
updated TODO and descriptio