Mostly cleaning up some code