Rewrote some parts of the parser to be more idiomatic (linq etc).