two matrix version working