Checked for empty values and added more console.log messages.