Added option to automatically merge nodes to neighbor nodes