simplified normalizing directories in path to not fork
added a helper function to strip a given directory from the PATH