Multiple changes

Code is now following PEP 8.
Fixed the code to support versions Python 2.6+.
Minor performance improvements.