history button handling