Adapted to Python 3 (and ST3)