added pb's consensus algorithm with my own modifications