use promise based version of `compile` for roots-util
move private methods below