Begin compareNodes refactor to recursive function
compareNodes: Remove uneeded val variable