at size loops declare i as unsigned for correct type comparison