index added to separate pf types if necessary, function changed to return reference of vector instead of copy