Corrected a mistake in the signed-ness of the data array and in the spacing character written for the general case
Cleaned up the spacing and newline logic so it won't over-write newlines or spaces on encountering end-of-file