refactor Path creation and string manipulation