RNN-G: grammar_trainer: refactored, updated, debugging, etc.