Added mutex protection for thread safety