Separated DB and User Functions

Separated DB and User Functions into separate classes.