Updated bool running into atomic<bool> running to avoid possible race conditions
bool running
atomic<bool> running