Refactor bet handling