Successful emitTree created based on work done by @camluca in 4954a1ad1d9b034abbd3c23c4581324fb6b8fa57