Cleanup in some of the code