expm rewrite