Another attempt to ensure thread-safety.