Add code logging, beef up network handling