Refactoring and adding tests of counts
Refactoring delete links