Properly implemented mode toggling mechanism