Optimized equals handling