Yeah, there is some better code that I think has already been merged in, or in another PR. I'll have to dig for it.