Replace code with function call