Code refactoring: new token.js, new cors.js, improved messages