code ready for lab7 submission