More general-purpose cleanup in preparation of adding functionality.