Refactor tokenizer for an easy browserfy