Refactor/layer validation