Added handling for selecting number of files