Implemented Spam detection

Refactoring.