Lots of changes to db interaction later