Improve classifyPerson function