some updates to search function