Code cleanup and new API (Create network from selected).