refactored to use BinaryMessaging trait