Using visitor pattern.