improved whitespace detection and preservation to be even closer to the input (even if it's ugly)