Added sort statement to make sure the returned requeries are consistent.