Cleaning up some bad coding practices