Reorganizing custom function code.