Adding some comments to horrible code :)
Made it working, but still problems with paths.
Added support for 2.6, used discovery.py module from 2.6, BSD license.