Improve whitespace handling