Can you just reuse `val` here, instead of introducing another variable?