changed console log logic