Removed atomic bool and replaced it with bool/mutex