added threading for Main.py