finished the  code