applied the dry run in the code