greatly simplified the whitespace parsing code