Extracted out as much of the boring database stuff as I could into a shared class for the intervals. Also changed the Periods to only have two types.