Modified thread-safe api strategy for performance, edited thread demo for relevance