Refactor tokenfield plugin. Fixes #2