more groovy refactor