Added network splitting and fixed merging