Cleanup of some code