More thread safe use of maps