Removed unnecessary files
Create output directory if it does not already exist; tidy up variable names