The third code section you posted: does it return true or false?