added condense_path function