added index functions and completed diff with index