refactored win checking