second draft of matrix output