Refactor streams and stream writer into replicas.