moved search and service helpers into lib