Depolymerization and polymerization in confined spaces