use algebraic matrix operations (still broken, but looking reasonable)