tightens validation of cURL return

 This should prevent single-byte files from being created,
 as thesse were the result of uncaught websdervice 404 responses.
 404 is returned when no photo exists for a given idnumber, and
 previously, a file was creates with a single whitespace as the
 full content.
adds return value so this highest level fn can be tested for regression
adds comments, refactors names, adds utility functions