Using enum instead of if-else chain for intervals
Merge pull request #1138 from caspervg/enumify

adding IntervalType enum instead of long if-else chain