pull query value parsing into function