works fastish for TotMatAt. Perhaps need more indices still. go fmt