Cleanup and py3 fixes.