changed files to imfiles to avoid conflict with for loop.