Modified packageFileList to use a when promise

Simplified some of the code in packageFileList by implementing a when
promise.