Refactoring to accept tokens