Refactor to fix path resolution when loading config file and remove duplication