Added code for visitor pattern, fixed compile issues.