Migrating more core token utils functions from HaRe