Added index and solved problem 3