parsing query string more properly