Added out-of-bounds checking for feature_extractor. Made sure clustering didn't break from the refactoring.