put logic in a method and call it from main
improve module comment
convert file comment to python format