Working code. Going to fix reading from nodefile.dat