Avoding console log and better empty check