Added better testing for nulls to prevent exceptions during test of whether or not to print out the data.