Complete  rewrite

The code has been completely rewritten:

- Comprehensible code and comments
- Removed layering bug
- Demo items look better