Code cleanup

This includes 2 rounds of cleanup. Tested and the app works, with 2 types of users. There aren't a lot of tests in place so this was mostly manual testing while I viewed updates in the UI and db.