changed the code so that it is consistent with the presentation