move the cleanup stuff into the transformer