Add a more general hasMode function