Refactor helper functions out into util
WIP commit, starting to add a tree shaking pass