main scaffold copyied from polymer sampler-scaffold