Added mutexes for shared access variables