moving index arry to private var, fixing some indentation