combined some textfile writing stuff from Sindu with Helen's data collection stuff.