removing stray divs and invalid characters