moved search function