Cleanup some of the code