Updated code for lab9