Refactor mode querying to TokenUtils.getModeAt()