Add support for per-iteration callback (close #22)