Revert "Code for visitor pattern"

This reverts commit 304d7e0df9cacfd74749394f30b64f124b34a134.