refactor sequence impl