Fixed the issue for the intervals
Modified the plot function slightly.