Fixed database creation and changed db methods to reflect the new
db design