I think this would probably be clearer as a stand-along function, which could then short circuit by returning false on failure.

Aside from that, LGTM