Added RWMutex for read and write locking.