New approach to fix NaN handling in highlighting