add function to automatically build listnode
refactor code