implement proper matrix multiplication