Period group function fix. Incomplete. Solve part of #68

* It doesn't work with a structure with 1 period for each part