Using enum instead of if-else chain for intervals