Small refactoring to Main