moving processing of parameters to Query