Replace ipairs loop with numeric for loop