Modified method prepare_data_for_feature_selection for performance