Visitor design pattern implementation