Revert "Clean function bug fixes."

This reverts commit 1a208351a2c6903053d187f7be1fce0a858aedbb.