solved the newline-removal much more elegantly