console.log added to first if statement