Canned reply logic moved to separate function