Add network handling, and separate ipv4/v6