Adding some thread-safety