Major update - moving database methods over to the server.