Refactor Firetext.js