Refactor to isolate transformation