We should add specific test cases for this and the inner octagon to make sure it actually does what we want. With all this indexing it is very likely there are some hidden bugs...