- adapted to changes in matrix lib
- finalised code appropropriation :-)