Counting lines. Should do some refactoring.
Parser states refactored.