Revert "match code layout"

This reverts commit f439b6e11c46a28a4f0fb3ed0416105f53bb57c9.
Revert "Fix a race when a message is sent as the last connection is lost."

This reverts commit 812eb7c9f0993a17ef708a6d2f31d0a5ee91f365.