cleaned up some code. last edit before I try breaking things on localhost.