Move the mutex to the top of the method so it also protects the comparison above?