Convert areEqual() into a local function