using indexing to optimize performance