Rewrite function calls