replace for-expression with cfor