Changed return statements and insertNode call