Implemented redirect_output and reset_output