Refactor main.py

Moved functions to classes and configs to functions.
Pycharm used for most of the refactor.