Added more code, but the database stuff seems to be broken?
Need to figure out how it works first.