ported to python3, many simplifications and clean-ups, added standard command line handling, IANU complyant build.