adding more functionality to Interval class