Improved the token expansion in dialogue package