See #228. Switch some internals to prototypes, simplify message delivery