move to folders; fixes in matrix class