Additional refactoring.
Preparation for LayerBackup and MatrixBackup.
Started creation of LayerBackup.
Use LayerBackup for backup and restore.
Started using MatrixBackup.
Complete usage of MatrixBackup.
Factoring, re-naming, correction of comments.
Factored a function.
Factored more functions.