Refactors utilities a bit.