refactoring of smart parser