Successfully split up my ruby script into several files. One which handles encoding, one which handles the coefficient arithmetic, and one which runs everything. I still may need to make a Polynomial File of my own which uses my coefficient arithmetic in the calculations.