cleaned up win detection