Making the val macro a bit more general purpose.