Incorporated Peter's fix in getting the query parameters passed too.