improve s3 interface and extract bft into a library of its own