A unit test revealed several bugs with the initial findMostRestricted() function.