refactored decoder for a bit more clean abstraction
added adhoc "extra metadata" support (currently read-only)