moved playAction into function