Made the public interface thread safe.