Add hasChildren() function with specs