Lots of changes to better support multiple networks