locating function and extracting then rewriting its code to match Function.toString()