Modified some more code to work with Py3k. Some tests are not passing yet.