Moved the initialisation and cosing of the rex configuration process into a module by itself in order to make the Rexfile cleaner.