add the refined code of 1-18