removed console.log and relaxed unnecessary conditional