Your suggestion is clever/clear than mine.
Less local variable should be a better design.

Will address this in next patch.
Thanks!!