@shagunsodhani yes, you are correct. But to keep the code simple (as its an example), we are doing some identical work.
I’d be willing to accept a PR that keeps it simple, but does what you are saying we should do.