Looks like this line can be factored out of the if/else since it is the same for both branches?