Added basic db functions (NOT FINISHED)