updated with search function