refactored ast tree walker mechanism