Changed all variables to array with indices.