added helper function createNode( )