bencoder rewrite