Some code tidy-ups in parser.rb