mode cleanup and enhancement