Refactored some code and added betting.