Code cleanup
Process query args in fewer steps