Refactored deleteBySource and exposed this to the shell script