create library for unflattening