replace code by a function call