bet refactored