completing sorting