Added similarity check to database listener