smarter whitespace cleanup