Worked on improving error checking using a tree listener