add remove_members_outside_rank

I think this one is better than my first pull request. We simply remove any member outside the given rank.