refactor plagiarism_check.rb