Refactored a bit of code, making it more clear to have threadsafe copies of each sample.