Update: refactor tokens API (refs #1212)