Added index in format function