Updated to make compatible with Python3