added source code from Codeminders mercurial repository