Implemented stream compaction.