Updated the auto-mode algorithm.