small refactor in main