What is the version of the following sentence with correct punctuation?

To do this he had to develop not only new mathematical ideas but also he had to develop some of the first computer programs to print graphics
To do this he had to develop not only new mathematical ideas, but also he had to develop some of the first computer programs to print graphics.