period is unsigned integer, so it cannet be negative (if-statement changed to ==)