Implemented the main index functionality