removed unneeded sort calls