changed function declaration to TNode type