Work on getInterval()

More reliable, properly tested version

Change-Id: Ic8e614c06108f18a8b8449654f1ab23667c70240