updated path handling and made directory components cross-platform