WIP: Refactor layers like ggplot2

Related to:
- issue #221
- issue #160

Sharing code with
- PR #235

This PR is a work in progress, its direction is discussed at #221.