Generalize a couple of transforms a bit