optimized with two different value types