add history functionality