Updated the thread comparison function to use the testConstraint subroutine