additional comments and cleaner organisation of the script body