binary data decoding reworked