Slight refactoring in Main