Cleaned up code
Added DocumentParsed callback to rebuild path