some resorting in the beginning