made splitPath re-usable