`val.toString() is called two times. Could we cache in in local variable?