Rewrite with cpp