small main refactor