added double period detection