Fixed data races; Closes #1.