Finish apply-transform and write tests for it