Add requirements and fix main.py's run to be at the end.