Added build_path function for combining path elements