Completed reorganisation of script into separate files