transition and cleanup