Improving tests (adding test cases, formatting source code, enhance output).
Adds support for non-square matrix inputs.