IntervalCalc instruction fixes, refactoring and tests