improved output-implementation