Previous gateway detection attempt was messy and actually only worked because of a fluke. This one's fine though.
Some simple performance improvement fixes, although it likely won't affect anything.
Added "tech" field to opaque messages to allow faster (and non-locking) splitting of non-cloud messages (which are far more common).