Added error and activity logging, cleaned up a bunch of code, uploaded new database