added conditional console log