Changed the renaming process to rename to an temp name and then to a final name to avoid renaming conflicts.

Fixed splitstring having an error when there was no spacing character or the character was the only one and in the first position in the string.