ported to Python 3.x (broke support for Python 2.x)