add db schema. should be okay for now
add db functions
fixed catastrophic syntax error