added @CompileStatic and made a bit more Groovy