Formating cleanup of main for readability
Restructered AutoMode a bit