Fixing signedness for loop
Updated for loops to use size_t