Only sorting collections when appropriate, cleaning up