Yeah this entire file needs to be rewritten. I have a card in trello. I plan to jump on it soon!