Added checkForTie function