Add data set information in data output
Check return value before breaking out of loop