Refactored the main function in PlayGame