modified comments to clarify sortid method