added cleanupPhase