Reducing the race conditions