Final updation -completed code