Remove unused variables
Get rid of pre python 2.6 hacks (functools)
More unused variables and dead code removed (pyflakes)