getting orders sorted