remove redundant text and spaces