Better tests for cached range queries
Update documentation
Refactor