Initialise n_runs and first_run in the arguments to the function. Also, make the script compilable