Modified main.py so it can be run from a console_script