refactored out data read
refactored the read data to encapsulate the read, validate, sort functions