Refactor spatialindex for 100 line limit