Fix getEligibleInputs so it iterates over only well defined range of a series

Introduced the SeriesRange struct to defined a range on a series