refactoring around groovy