saves all temporary variables directly into the array.