I'll replace it with your suggestions. Nonetheless, the entire function needs better commenting. Since 1) OSG is an external library, 2) few people can be considered to have experience with it, and 3) it's poorly documented, it makes sense to err on the side of too many comments here. If you understand what this function is doing, you might take a second to roughly sketch out its workings.