I think with a try/finally you can move this for loop out of the if so it's not duplicated. Also, can we use a 4 space indent?