Getting the database stuff working