moved parsing of query fields from server to client, made various fixes