nit: not part of your patch, but can this just be AnyRef?