sort collection
optimize by selecting only correct path