Sorry to be pedantic, but `files` should be a local variable, not a global variable; which means it needs to be prefixed with `var`.