Change internal layout, add tests
Add files, forgotten in previous commit