Added win checking logic