works for multiple files now