Changed document.write to console.log