added history functionality