added history search function