Cleaned up transform()