move path code construction from constructor to a separate method