cleaned up bet code