first attempt at decoding using the new API

------------------

compiles but has not been tested :)