This new implementation is based on http://github.com/imbcmdth/RTree/, with only a few modifications to add the optional type and provide the API of the previous implementation. There is still room for optimization, but this is such an improvement over the previous RTree already that it's worth bringing it in now.