Replaced every instance of volatile to atomic vars. Changed thread pointers to thread objects (movable).