Minor fixes to cleanup code