refactored to embrace sequence abstraction