adding thread-safety with dispatch queues