added trailing whitespace stripping