a naive generic version