Rewrote parsing with Parsec library.