Added spam detection function.