Changed to work for python 3.