refactored db queries. stores start/end index for bounding region