Concurrency: Working with shared data using threads