Added method to compute token id