@panigrc I also thought of something similar after posting this :D
I'm still not sure which one I prefer though. This one may be easier to understand, but the performance is not as good. Of course, that depends on whether performance is important or not, the context of the project where this is being developed, etc.
I was vague on purpose to see how people react.