interval: cleanup code and documentation