Python 2.6 Compatibility

I have added support for python 2.6.6 (default version on debian squeeze) and done some small refactoring

Cheers

Andrew