Refactoring

Moved some of the complexity out of getImages into getFilenameArray to collect the list of files from the directory given to us and filterfilnameArray to filter the list of file names down to the ones we want.