Added mutex for safety