move Intervals class at the beginning of the file