implimented the index equation