add initial decoding implementation
more complete decoding