implemented the interval functionality