Fix cpg:leave to leave only once.  That means you will now need to call cpg:leave as many times as you called cpg:join (the same as pg2) to completely leave a group (previously only a single call would remove all instances of the Pid in the group).  This does not affect the leave that occurs when no group name is provided (only the Pid is provided).  Add the function cpg:join_count to provide the count of the Pid instances within a group.