Groovified code and improved tests.