refactoring bet