Corrected implementation of PGM image format that seemed incorrect
Replaced 5000 for loop with a while loop that exits when appropriate
Revmoed printing image integers to the terminal (very slow)