token expanding function