Make an start with the free function from Glib.
Move more of the global functions.