Merged with the main repository. Added some conditional imports for compatibility with Python 2.5