I think this if is unnecessary because it is also covered in the last iteration in for loop.