Updated to work python 3