More factoring of Layer.
More factoring of Layer.
Various refactorings.