This needs to stay a `def`, I think. If it's a `val` then the action is evaluated once, straight away, and never evaluated again.