refactored play.py