Moved processing logic into a dedicated ns;  Added ability to write numbers to file as it goes