Open files in decide function and pass parameter