Make sort algorithm