refactor of the layer model
fix
layer / trim fix
Merge pull request #6 from afewyards/master

Refactored the layer system