Would it make sense to put this in a utility function somewhere?