added player state check function