query tweaks for correctness
alphabetic ordering on parameters, kind-of on variable names