Ran through 1000 test cases and fixed tai's bug.