Start cleanup of mode handling.