Refactor clearup.