Slight improvement: `upTo` is visible from the enclosing method, and it's never changed, so you can eliminate it.