Some speed optimizations. matrixto does not accept fmt parameter any more. fixed typos