Implement interval tree and selective removal/addition of layers

Significant performance improvement overall. The country borders demo
now runs at a decent clip, whereas before it lagged on each frame.