Update some code for pretty-ness and make it less global