Changed TimePeriod from enum to class. Fixes #547