implemented visitor exercise