cached matrix done. with comments