Use better types for isElem