renamed mode to current_mode