setPeriod method added.