This seems fragile - either querystring parser or using the JSON API is advised I think...