part1 complete

Not very efficient, but it works.