Further work with layers
Merge branch 'refactor' into layers
Layers minimally wired up again