Rewrote transform for clarity