Add input validation and tie game function