added in ordering of where queries