added better error handling. Also refactored some of the code and fixed a few issues in project_tree_saver