Removed more unneeded imports and fixed a py3k compatibility issue.