refactoring: elem in grammar