refactor to simpler setup, matrix multiplication