[FOLD] (Optional) use std algorithms not hand-rolled loops