completed example with output information

also replaced custom interfaces by Function/BiFunction, because they
were complicating the example