Adds database storage of user prefs

May or may not work, needs a look over by someone else