Temp array is confusing and not necessary