Can we improve types here? /cc @odersky