Betting refactor and testing