updated with better search function