Moves sorting to update func