More intelligent whitespace parsing and other parser improvements