Cleanup a few unused things, and implement some py3k compatability.