put sort into separate file