cli tool improvements, python 2 and 3 support, code style improvements.