Wrap urlquery handling in one function