Advanced with adding the bet function