Added support for inverted intervals (future time) and unit tests