Canonicalize collections in builder pattern

Improves code quality as well as performance. @andreistefanescu @dwightguth please review