Implemented nodelisttoarray function.