The type params for the inner tuple are a bit opaque; should use a case class for better readability.