Calculate offsets correctly
The code calculating the offsets to place copies of the template layers has two shortcomings:
- It requires the template layers to be put directly adjacent of the entrance layer, because it tracks offset from there. This also requires that all templates have the same width and height, and same number and positions of links.
- I am not even sure it does the right thing under these assumptions
Someone should rewrite the code to correctly position the copied layers, probably from scratch.