Refactoring Main