Refactor how the function is set to simplify decorator setup.