Add addTransform and insertTransform

Also fix some bugs