A bit of refactoring, added comments to a visitor