Refactor two mains