Refactoring of function call rewrites