newer version of cappi
moving things around, first approach was too naive and performed too poorly, second approach performs closer to apache commons and note supports arbitrary input