Clean up some code and add some stuff