refactor with more conventional groovy