Added indexing to speed up queries