this looks odd, if you are stripping '\n' how are you going to split on it if it is removed? unless your intention is to remove the trailing newlines only?