Minor cleanup of the interval question

* Adding unit test for the interval question.
* Adding comment.
* Cleaning the coding style a bit.