Moved sudo check into main