Adding a dry run and improving the code