Replaced lists:foldl for #5