mavenized and refactored code from old google-code version of same project