started major refactor in main_new.py