Refactor to use the new pbf version

Refactors the code to use new features of pbf + some minor cleanup. Also adds a benchmark to make sure we don't regress performance (this time we don't).