some basic conversion of some code from main.py for the main conversion flow