update code to do as the assignment says