Move parsing mode check into its own function