Fixed errors with index and formatting