fix win logic, split diag into own win function