Maybe add a comment explaining that all these lines just append B to A. There's probably a better way to do this, but I am not good enough with Matrix to immediately say what it is.