moved typed exists function