Cleaned code for searching location and provider