Use filter and iter instead of fold and for-loop