code ready for lab7 v2