added console.log and altered if statement