Added code to visitor pattern