master.cfg: move functions to "top" of file