add function to get distinct PM folders; remove unused stuff