Correctly specify transform function as callback and move to top of file.