started factoring out Main