User schema

Fix the user schema and extract the db abstraction to a separate file. Make user object wrap the db function.