Fixing the logic of using size before as the index variable.