now works with multiple files