Refactored code into main and GraphMaker

Needs testing