generate folder list in a separate method, check if folder exists

Code for generating the folder list has been moved to a seperate method, with the option to extend the list. Also a check has been added to check if the folder still exists.