Small refactor of PatternLimitedStream.