Clean-up variables
Created function mktempdir()
Reorganised functions
Reorganised reading and writing of config file
Various cleanups
Wrapped printing of help message in own function