Added some error handling, and creation of output folder