r21049: Start to refactor some of the setpath set code