Remark: This loop could be parallelized.