added checking for existence of uploads and output folder, and to create them if they don't exist