Created functions out of code in Main.py