implemented the interval part