moved code from svn.codehaus.org