Moving the clean up code to a central place.