more matrix, faster, seems to be correct