second draft with output