[UPDATE] Refactored to allow multi/single env buckets

Also refactored out some duplicate code and cleaned up the comments and
flow quite a bit. Still need to implement the file_emptydir_list