added Python 3 support, made program a class