update classify method using functin programming