Super commit (bad practice ahead!). The matrix handling part looks to be
refactored. Data handling part has been partially reestructured. Both
parts need to be tested in complete scenarios.