improve functions which decide if you win or not