New implementation of DEC which works with routeIntervals.
Corrected the gap function to work with routeIntervals.