Updated addFile method