Clean up, make it more Groovy, add some comments.