api for saving user preferences and sqlite3 api cleanup [try2]