Search params

Based on #2887, I've made some adjustments for handling query strings and used an API hook instead of an explicit method for query parsing.