Refactor to clean up some of the transforms