updated latent groovy script to work with new representation