updated to current version of Julia; optimized build_tree()