Added code for manual indexing