ported the dihedral periodic stuff into this pr