Some refactor. Cleaned up the parser.