Added semaphore to sampleData to avoid multiple accesses to the same
data + reformat.