Moving path.join inside the functions rather than in JSON object