CHRON-56 Refactor TCP layer, minor cleanup