add code from terraformer core repo