refactoring spam protect