Updated with Python 3 script