improve history functionality