finished tests. Refactored code to work with tokens