Updated to support python 3