Updates to error handling and adding currentPath to tree