Get rid of empty nodes and whitespace