added first impl. with failures
added pbf support