Refactor a bunch of utilities/helpers