Attempt to add flexible output function.