Changed to filter out only trailing whitespace