re-arranged some code, less lines, more groovy!