updated groovy script, added population method for hasMean