refactore bft and add some testcases