Did some refactoring in SelectFeatures, trying to sort out a bug.