Moved index query to its own class
Fixed a comment