Enhancing working out of paths and file name, also globalising required variables for plugins.