move console.log into external function