Write tests for, and implement, actions 1 and 4. Refactor some grammar code.