FindAndReplace: Improve function call replacements (new addFunction() method) and better formatting