Actually correctly building matrix (didn't realize it would do this).