Attempt making thread-safe