Clean up some parts of the code