apply visitor pattern