added bits of weak prime gen