Use simpler to lower impl (teve chef trick)

This is not a demo for c++ code so the functions used should be simple
and wrap the somewhat complex syntax used by <algorithm>.