I think cleanUpComponents looks very similar. Couldn't we reuse it?