Simplify equal function