update codes with lecture's code