Move more things into util.c